package com.ndp.fb.enums.targetingspec;

import lombok.Getter;

/**
 * Created by Sisi on 14-11-18.
 */
@Getter
public enum Gender {
    all(0, "All"),
    male(1, "Men"),
    female(2, "Women");

    private int code;

    private String gender;

     Gender(int code, String gender) {
        this.code = code;
        this.gender = gender;
    }

    /**
     * 根据code获取Gender
     *
     * @param code code
     * @return userOs
     */
    public static Gender getGender(int code) {
        for (Gender c : Gender.values()) {
            if (c.code == code) {
                return c;
            }
        }
        return null;
    }
}
